<?php
# ==================================================
# Lista com toodas as funções contidas neste script
# ==================================================
#
# faz_aguma_coisa ($paramtros) - Template para a criação das funções
# ==================================================

// ========================================================================================================================================
// FTemplate para as funções
// ========================================================================================================================================
function faz_alguma_coisa ($parametros) {}
// ========================================================================================================================================



// ========================================================================================================================================
// Garimpa a url do vídeo do Youtube
// ========================================================================================================================================
function multiexplode($delimiters, $string) {
    $ready = str_replace($delimiters, $delimiters[0], $string);
    $launch = explode($delimiters[0], $ready);
    return  $launch;
}
// ========================================================================================================================================



// ========================================================================================================================================
// Entrega os codigos de publicidade do adsense
// ========================================================================================================================================
function delivery_adsense_code ($size) {	
	if ( $size == '250x250' ) { ?>
		<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
		<!-- AvesPT 3 (250x250) -->
		<ins class="adsbygoogle"
		     style="display:inline-block;width:250px;height:250px"
		     data-ad-client="ca-pub-7597001385191345"
		     data-ad-slot="4350590717"></ins>
		<script>
		(adsbygoogle = window.adsbygoogle || []).push({});
		</script>
	<?php
	}
	if ( $size == '320x50' ) { ?>
		<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
		<!-- AvesPT 3 (320x50) Telemóvel -->
		<ins class="adsbygoogle"
		     style="display:inline-block;width:320px;height:50px"
		     data-ad-client="ca-pub-7597001385191345"
		     data-ad-slot="8780790314"></ins>
		<script>
		(adsbygoogle = window.adsbygoogle || []).push({});
		</script>
	<?php
	}
	if ( $size == '300x250' ) { ?>
		<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
		<!-- AvesPT 3 (300x250) - Coluna Lateral -->
		<ins class="adsbygoogle"
		     style="display:inline-block;width:300px;height:250px"
		     data-ad-client="ca-pub-7597001385191345"
		     data-ad-slot="5842752311"></ins>
		<script>
		(adsbygoogle = window.adsbygoogle || []).push({});
		</script>
	<?php
	}
	if ( $size == '300x600' ) { ?>
		<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
		<!-- AvesPT 3 (300x600) -->
		<ins class="adsbygoogle"
		     style="display:inline-block;width:300px;height:600px"
		     data-ad-client="ca-pub-7597001385191345"
		     data-ad-slot="5827323912"></ins>
		<script>
		(adsbygoogle = window.adsbygoogle || []).push({});
		</script>
	<?php
	}
	if ( $size == '468x15' ) { ?>
		<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
		<!-- AvesPT 3 (468x15) - Por cima da pesquisa -->
		<ins class="adsbygoogle"
		     style="display:inline-block;width:468px;height:15px"
		     data-ad-client="ca-pub-7597001385191345"
		     data-ad-slot="2040164712"></ins>
		<script>
		(adsbygoogle = window.adsbygoogle || []).push({});
		</script>
	<?php
	}
	if ( $size == '468x60' ) { ?>
		<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
		<!-- AvesPT 3 (468x60) - Final da página -->
		<ins class="adsbygoogle"
		     style="display:inline-block;width:468px;height:60px"
		     data-ad-client="ca-pub-7597001385191345"
		     data-ad-slot="4854030314"></ins>
		<script>
		(adsbygoogle = window.adsbygoogle || []).push({});
		</script>
	<?php
	}
	if ( $size == '728x90' ) { ?>
		<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
		<!-- AvesPT 3 (728x90) -->
		<ins class="adsbygoogle"
		     style="display:inline-block;width:728px;height:90px"
		     data-ad-client="ca-pub-7597001385191345"
		     data-ad-slot="7304057112"></ins>
		<script>
		(adsbygoogle = window.adsbygoogle || []).push({});
		</script>
	<?php
	}
	if ( $size == '970x90' ) { ?>
		<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
		<!-- AvesPT 3 (970x90) -->
		<ins class="adsbygoogle"
		     style="display:inline-block;width:970px;height:90px"
		     data-ad-client="ca-pub-7597001385191345"
		     data-ad-slot="7304057112"></ins>
		<script>
		(adsbygoogle = window.adsbygoogle || []).push({});
		</script>
	<?php
	} 
	?>
<?php
}
// ========================================================================================================================================


// ========================================================================================================================================
// Publicidade do Google Adsense 468x15 div com dois blocos 468x60
// ========================================================================================================================================
function add_google_pub_bloco_2x468x60 () {
	?>
	<div>
		<span class="pub-retranca" style="float:left;margin:-15px 0 0 25px;">PUBLICIDADE</span>
		<div class="gpub-468x60" style="float:left; margin-left:25px;">
			<?php delivery_adsense_code ('468x60'); ?>	
		</div>
		<span class="pub-retranca" style="float: left;margin-top:-15px;margin-left:43px;">PUBLICIDADE</span>
		<div class="gpub-468x60" style="float:right;margin-right:25px;">
			<?php delivery_adsense_code ('468x60'); ?>	
		</div>
	</div>					
	<?php
}
// ========================================================================================================================================


// ========================================================================================================================================
// Barra com título de bloco da home
// ========================================================================================================================================
function do_title_bloc_news ($titulo, $link) { ?>
    <div style="width:630px;margin:0 0 25px 25px">
		<div style="float:left;font-size:24px"><?php echo $titulo ?></div>
		<?php 
		if ( $link != '' ) { ?>
			<div style="float:right;font-size:18px;padding:5px 40px 5px 40px;background-color:#efe43b">
				<a href="<?php echo $link ?>">Ver tudo</a>
			</div> 
		<?php
		} 
		?>		
	</div>
	<div class="vertical_space_20"></div>
	<div class="clr"></div>
<?php
}
// ========================================================================================================================================


// ========================================================================================================================================
// Bloco de notícias em destaque, mostra n notícia em linhas (Horizontal) 
// ========================================================================================================================================
function do_bloco_destaque_noticias ($titulo, $link, $categoria, $qtde, $corte) { 	
	do_title_bloc_news ($titulo, $link); 
	$categoria = retira_acentos((strtolower($categoria)));
	$qtde_plus = $qtde+5;?>
	<div class="destaque-home">		
		<?php
		$postCount = 0;
		$the_query = new WP_Query('category_name='.$categoria.'&posts_per_page='.$qtde_plus.'&offset='.$corte); 
		if ( $the_query->have_posts() ) : 
			while ( $the_query->have_posts() ) : $the_query->the_post();
				$postCount = $postCount + 1;
				if ( has_post_thumbnail() && $postCount < $qtde ) { ?>
					<div style="margin: 10px 0 0 0;height:auto; width:140px;background-color:#fff;float:left;">
						<div style="float:left;margin-right:10px;width:140px;">					
							<?php the_post_thumbnail('mini'); ?>
						</div>
					</div>
					<div style="margin: 10px 0 0 0;height:auto; width:10px;background-color:#efefef;float:left;"></div>
					<div style="margin: 10px 0 0 0;height:auto; width:474px;background-color:#fff;float:left;">
						<h2><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
						<p style="color:#020202;font-size:10px;margin:5px 0 5px 0;"></p>
			    		<p><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(155); ?></a></p>
			    		<p style="color:#c2c2c2;font-size:11px;margin:5px 0 5px 0;"><?php the_time(get_option('date_format')); ?> &nbsp;&nbsp;&nbsp;Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>						
					</div>				
					<?php
					if ($qtde == 1) { ?>
						<div class="clr"></div>
						<div class="vertical_space_10"></div>
						<div style="border:dotted 1px #efefef;width:630px;margin:5px 0 5px 0;"></div>
						<?php
						break;
					} 
					if ($qtde_plus > 1) { 
						if ($qtde_plus == $postCount) { ?>
							<div class="clr"></div>
							<div class="vertical_space_10"></div>
							<?php
							break;
						} else { ?>
							<div class="clr"></div>
							<div style="border:dotted 1px #efefef;width:630px;margin:5px 5px 5px 5px;"></div>
						<?php
						}
					} 
				} else { 
					if ($qtde == 1 && $postCount == 1) { ?>
						<div style="margin: 5px 0 0 0;height:auto; width:630px;float:left;">
							<h2><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
							<div class="vertical_space_4"></div>
				    		<p><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(255); ?></a></p>
				    		<div class="vertical_space_4"></div>
				    		<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;"><?php the_time(get_option('date_format')); ?> &nbsp;&nbsp;&nbsp;Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
						</div>
						<div class="clr"></div>
						<div class="vertical_space_10"></div>
						<div style="border:dotted 1px #efefef;width:630px;margin:0 0 5px 0;"></div>
						<?php
						//break;
					}					
					if ($qtde == 1 && $postCount > 1) { ?>
					<div style="margin: 5px 0 0 0;height:auto; width:630px;float:left;">
						<span><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></span>
					</div>
					<?php
					}
					if ( $qtde == 1 && $postCount == $qtde_plus ) { ?>
						<div class="clr"></div>
						<div class="vertical_space_10"></div>
						<div style="border:solid 1px #efefef;width:630px;margin:10px 0 10px 0;"></div>					
					<?php
					}
					if ($qtde > 1 && $qtde >= $postCount ) { ?>
						<div style="margin: 5px 0 0 0;height:auto; width:630px;float:left;">
							<h2><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
							<div class="vertical_space_4"></div>
				    		<p><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(255); ?></a></p>
				    		<div class="vertical_space_4"></div>
				    		<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;"><?php the_time(get_option('date_format')); ?> &nbsp;&nbsp;&nbsp;Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
						</div>
						<div class="clr"></div>
						<div class="vertical_space_10"></div>
						<div style="border:dotted 1px #efefef;width:630px;margin:0 0 5px 0;"></div>
						<?php
						//break;
					} 					
					if ($qtde > 1 && $postCount > $qtde) { ?>
					<div style="margin: 5px 0 0 0;height:auto; width:630px;float:left;">
						<span><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></span>
					</div>
					<?php
					}
					if ( $qtde > 1 && $postCount == $qtde_plus ) { ?>
						<div class="clr"></div>
						<div class="vertical_space_10"></div>
						<div style="border:solid 1px #efefef;width:630px;margin:10px 0 10px 0;"></div>					
					<?php
					} 
				}
			endwhile; 
			wp_reset_postdata();			
		endif; 
		?>
		<div class="clr"></div>		
	</div>
	<div class="clr"></div>
<?php
}
// ========================================================================================================================================



// ========================================================================================================================================
// Bloco de notícias em destaque, mostra 2, 3 ou 4 notícia em colunas (Vertical) 
// ========================================================================================================================================
function do_bloco_destaque_noticias_vertical ($titulo, $link, $categoria, $destaques=array()) {	
	do_title_bloc_news ($titulo, $link); 
	$categoria = retira_acentos((strtolower($categoria)));
	?>
	<div class="destaque-home">		
		<?php
		$aux = 0;
		$qtde_array = 0;
		foreach ($destaques as $key => $value) {
			if ( $value == '' ) { # Do nithing 
			} else { $qtde_array = $qtde_array + 1; }			
		}
		foreach ($destaques as $key => $value) {
			$aux = $aux + 1;
			if($value=='') {
				// Do nothing
			} else {
				$the_query = new WP_Query('category_name='.$categoria.'&posts_per_page='.$qtde.'&p='.$value); 
				if ( $the_query->have_posts() ) : 
					while ( $the_query->have_posts() ) : $the_query->the_post(); ?>							
						<?php
						if ( $qtde_array == 2 ) {
							if ( $aux == 1 ) { ?>
							<div class="destaque-home-duas-colunas-coluna-um">
								<?php	
								if ( has_post_thumbnail() ) { ?>
									<?php the_post_thumbnail('duas-colunas-destaque'); ?>
									<div class="vertical_space_7"></div>
									<h2 style="text-align:left"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
									<div class="vertical_space_3"></div>
									<p><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(255); ?></a></p>
									<div class="vertical_space_5"></div>
									<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;">Data: <?php the_time(get_option('date_format')); ?> &nbsp;&nbsp;&nbsp;Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
									<div class="vertical_space_5"></div>					
								<?php
								} else { ?>
									<h2 style="text-align:left"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
									<div class="vertical_space_10"></div>
									<p><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(255); ?></a></p>	
									<div class="vertical_space_10"></div>
									<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;"><?php the_time(get_option('date_format')); ?> &nbsp;&nbsp;&nbsp;Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
									<div class="vertical_space_5"></div>
								<?php
								}
								?>
							</div>
							<?php
							}							
							if ( $aux == 2 ) { ?>
								<div class="destaque-home-duas-colunas-coluna-dois">
								<?php	
								if ( has_post_thumbnail() ) { ?>
									<?php the_post_thumbnail('duas-colunas-destaque'); ?>
									<div class="vertical_space_7"></div>
									<h2 style="text-align:left"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
									<div class="vertical_space_3"></div>
									<p><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(255); ?></a></p>
									<div class="vertical_space_5"></div>
									<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;">Data: <?php the_time(get_option('date_format')); ?> &nbsp;&nbsp;&nbsp;Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
									<div class="vertical_space_5"></div>					
								<?php
								} else { ?>
									<h2 style="text-align:left"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
									<div class="vertical_space_10"></div>
									<p><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(255); ?></a></p>	
									<div class="vertical_space_10"></div>
									<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;"><?php the_time(get_option('date_format')); ?> &nbsp;&nbsp;&nbsp;Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
									<div class="vertical_space_5"></div>
								<?php
								}
								?>
								</div>
							<?php
							}
						}
						if ( $qtde_array == 3 ) {
							if ( $aux == 1 || $aux == 2) { ?>
							<div class="destaque-home-tres-colunas-coluna-coluna-um">
								<?php	
								if ( has_post_thumbnail() ) { ?>
									<?php the_post_thumbnail('tres-colunas-destaque'); ?>
									<div class="vertical_space_7"></div>
									<h2 style="text-align:left"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
									<div class="vertical_space_3"></div>
									<p><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(255); ?></a></p>
									<div class="vertical_space_5"></div>
									<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;">Data: <?php the_time(get_option('date_format')); ?> &nbsp;&nbsp;&nbsp;Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
									<div class="vertical_space_5"></div>					
								<?php
								} else { ?>
									<h2 style="text-align:left"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
									<div class="vertical_space_10"></div>
									<p><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(255); ?></a></p>	
									<div class="vertical_space_10"></div>
									<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;"><?php the_time(get_option('date_format')); ?> &nbsp;&nbsp;&nbsp;Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
									<div class="vertical_space_5"></div>
								<?php
								}
								?>
							</div>
							<?php
							}							
							if ( $aux == 3 ) { ?>
								<div class="destaque-home-tres-colunas-coluna-coluna-dois">
								<?php	
								if ( has_post_thumbnail() ) { ?>
									<?php the_post_thumbnail('tres-colunas-destaque'); ?>
									<div class="vertical_space_7"></div>
									<h2 style="text-align:left"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
									<div class="vertical_space_3"></div>
									<p><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(255); ?></a></p>
									<div class="vertical_space_5"></div>
									<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;">Data: <?php the_time(get_option('date_format')); ?> &nbsp;&nbsp;&nbsp;Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
									<div class="vertical_space_5"></div>					
								<?php
								} else { ?>
									<h2 style="text-align:left"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
									<div class="vertical_space_10"></div>
									<p><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(255); ?></a></p>	
									<div class="vertical_space_10"></div>
									<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;"><?php the_time(get_option('date_format')); ?> &nbsp;&nbsp;&nbsp;Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
									<div class="vertical_space_5"></div>
								<?php
								}
								?>
								</div>
							<?php
							}
						}
						if ( $qtde_array == 4 ) {
							if ( $aux == 1 || $aux == 2 || $aux == 3 ) { ?>
							<div class="destaque-home-quatro-colunas-coluna-coluna-um">
								<?php	
								if ( has_post_thumbnail() ) { ?>
									<?php the_post_thumbnail('quatro-colunas-destaque'); ?>
									<div class="vertical_space_7"></div>
									<h2 style="text-align:left;font-size:15px"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
									<div class="vertical_space_3"></div>
									<p style="text-align:left;"><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(100); ?></a></p>
									<div class="vertical_space_5"></div>
									<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;text-align:left">Data: <?php the_time(get_option('date_format')); ?><br />Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
									<div class="vertical_space_5"></div>					
								<?php
								} else { ?>
									<h2 style="text-align:left;"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
									<div class="vertical_space_10"></div>
									<p style="text-align:left;font-size:15px"><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(100); ?></a></p>
									<div class="vertical_space_10"></div>
									<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;text-align:left"><?php the_time(get_option('date_format')); ?><br />Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
									<div class="vertical_space_5"></div>
								<?php
								}
								?>
							</div>
							<?php
							}							
							if ( $aux == 4 ) { ?>
								<div class="destaque-home-quatro-colunas-coluna-coluna-dois">
								<?php	
								if ( has_post_thumbnail() ) { ?>
									<?php the_post_thumbnail('quatro-colunas-destaque'); ?>
									<div class="vertical_space_7"></div>
									<h2 style="text-align:left;font-size:15px"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
									<div class="vertical_space_3"></div>
									<p style="text-align:left;"><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(100); ?></a></p>
									<div class="vertical_space_5"></div>
									<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;text-align:left">Data: <?php the_time(get_option('date_format')); ?><br />Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
									<div class="vertical_space_5"></div>					
								<?php
								} else { ?>
									<h2 style="text-align:left;"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
									<div class="vertical_space_10"></div>
									<p style="text-align:left;font-size:15px"><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(100); ?></a></p>
									<div class="vertical_space_10"></div>
									<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;text-align:left"><?php the_time(get_option('date_format')); ?><br />Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
									<div class="vertical_space_5"></div>
								<?php
								}
								?>
								</div>
							<?php
							}
						}							
					endwhile; 
				wp_reset_postdata();			
				endif;
			}	 
		}	
		?>
	</div>	
	<div class="clr"></div>
	<div style="border:solid 1px #efefef;width:630px;margin:10px 0 10px 25px;"></div>
<?php
}
// ========================================================================================================================================



// ========================================================================================================================================
// Bloco de notícias em destaque, mostra 2, 3 ou 4 notícia em colunas (Vertical) 
// ========================================================================================================================================
function do_bloco_miolo_destaque_2 ($titulo, $link, $categoria, $categoria2, $destaques=array()) {
	$categoria = retira_acentos((strtolower($categoria)));
	$categoria2 = retira_acentos((strtolower($categoria2)));

	if ( $categoria2 != '' ) { do_title_bloc_news ($titulo, $categoria2); }
	else { do_title_bloc_news ($titulo, $link); }
	
	$qtde_array = 0;
	// Verifica se há informações no array 
	foreach ($destaques as $key => $value) {
		if ( $value == '' ) { /* Do nothing */ }
		else { $qtde_array = $qtde_array + 1; }
	}	
	?>
	<div class="destaque-home">		
		<?php
		// Mostra destaques a partir dos ID da publicação fornecido (5 publicações)
		if ( $link == '' && $categoria == '' && $qtde_array > 0 )  { 			 
			$aux = 0;		
			foreach ($destaques as $key => $value) {
				$aux = $aux + 1;
				if($value=='') {
					// Do nothing
				} else {
					$the_query = new WP_Query('p='.$value);	
					if ( $the_query->have_posts() ) : 
						while ( $the_query->have_posts() ) : $the_query->the_post(); ?>							
							<?php						
							if ( $aux == 1 ) { ?>
							<div class="destaque-home-duas-colunas-coluna-um">
								<?php	
								if ( has_post_thumbnail() ) { ?>
									<?php the_post_thumbnail('duas-colunas-destaque'); ?>
									<div class="vertical_space_7"></div>
									<h2 style="text-align:left"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
									<div class="vertical_space_3"></div>
									<p><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(255); ?></a></p>
									<div class="vertical_space_5"></div>
									<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;">Data: <?php the_time(get_option('date_format')); ?> &nbsp;&nbsp;&nbsp;Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
									<div class="vertical_space_5"></div>					
								<?php
								} else { ?>
									<h2 style="text-align:left"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
									<div class="vertical_space_10"></div>
									<p><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(255); ?></a></p>	
									<div class="vertical_space_10"></div>
									<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;"><?php the_time(get_option('date_format')); ?> &nbsp;&nbsp;&nbsp;Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
									<div class="vertical_space_5"></div>
								<?php
								}
								?>
							</div>
							<?php
							}							
							if ( $aux > 1 ) { ?>
								<div class="destaque-home-duas-colunas-coluna-dois">
								<?php	
								if ( has_post_thumbnail() ) { ?>
									<div style="float:left;margin-right:5px;width:70px;">					
										<?php the_post_thumbnail('destaque-miolo-2'); ?>
									</div>
									<div style="margin:0;height:auto; width:232px;background-color:#fff;float:right;">
										<h2 style="text-align:left;font-size:14px"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>									
										<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;"><?php the_time(get_option('date_format')); ?></p>					
									</div>
									
								<?php
								} else { ?>
									<div style="margin:0;height:auto; width:308px;background-color:#fff;float:left;">
										<h2 style="text-align:left;font-size:14px"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
										<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;"><?php the_time(get_option('date_format')); ?></p>
									</div>
									<div class="clr"></div>
									<div style="border:solid 1px #efefef;width:308px;margin:10px 0;"></div>
								<?php								
								}
								?>
								</div>
							<?php
							}													
						endwhile; 
					wp_reset_postdata();			
					endif;
				}	 
			}
		}
		// Mostra destaques a partir de uma categoria fornecido (5 publicações). Ordena do mais recente ao mais antigo
		if ( $link != '' && $categoria != '' && $qtde_array == 0 ) { 
			$the_query = new WP_Query('category_name='.$categoria.'&posts_per_page=5'); 
			if ( $the_query->have_posts() ) : 
				while ( $the_query->have_posts() ) : $the_query->the_post(); ?>							
					<?php
					$aux = $aux + 1;						
					if ( $aux == 1 ) { ?>
					<div class="destaque-home-duas-colunas-coluna-um">
						<?php	
						if ( has_post_thumbnail() ) { ?>
							<?php the_post_thumbnail('duas-colunas-destaque'); ?>
							<div class="vertical_space_7"></div>
							<h2 style="text-align:left"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
							<div class="vertical_space_3"></div>
							<p><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(255); ?></a></p>
							<div class="vertical_space_5"></div>
							<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;">Data: <?php the_time(get_option('date_format')); ?> &nbsp;&nbsp;&nbsp;Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
							<div class="vertical_space_5"></div>					
						<?php
						} else { ?>
							<h2 style="text-align:left"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
							<div class="vertical_space_10"></div>
							<p><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(255); ?></a></p>	
							<div class="vertical_space_10"></div>
							<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;"><?php the_time(get_option('date_format')); ?> &nbsp;&nbsp;&nbsp;Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
							<div class="vertical_space_5"></div>
						<?php
						}
						?>
					</div>
					<?php
					}							
					if ( $aux > 1 ) { ?>
						<div class="destaque-home-duas-colunas-coluna-dois">
						<?php	
						if ( has_post_thumbnail() ) { ?>
							<div style="float:left;margin-right:5px;width:70px;">					
								<?php the_post_thumbnail('destaque-miolo-2'); ?>
							</div>
							<div style="margin:0;height:auto; width:232px;background-color:#fff;float:right;">
								<h2 style="text-align:left;font-size:14px"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>									
								<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;"><?php the_time(get_option('date_format')); ?></p>					
							</div>
							
						<?php
						} else { ?>
							<div style="margin:0;height:auto; width:308px;background-color:#fff;float:left;">
								<h2 style="text-align:left;font-size:14px"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
								<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;"><?php the_time(get_option('date_format')); ?></p>
							</div>
							<div class="clr"></div>
							<div style="border:solid 1px #efefef;width:308px;margin:10px 0;"></div>
						<?php								
						}
						?>
						</div>
					<?php
					}													
				endwhile; 
			wp_reset_postdata();			
			endif;
		}
		// Mostra destaques a partir de uma categoria fornecido (5 publicações). Ordena de forma aleatória
		if ( $link == '' && $categoria2 != '' && $qtde_array == 0 ) { 
			$the_query = new WP_Query('category_name='.$categoria2.'&posts_per_page=5&orderby=rand&offset=15'); 
			if ( $the_query->have_posts() ) : 
				while ( $the_query->have_posts() ) : $the_query->the_post(); ?>							
					<?php
					$aux = $aux + 1;						
					if ( $aux == 1 ) { ?>
					<div class="destaque-home-duas-colunas-coluna-um">
						<?php	
						if ( has_post_thumbnail() ) { ?>
							<?php the_post_thumbnail('duas-colunas-destaque'); ?>
							<div class="vertical_space_7"></div>
							<h2 style="text-align:left"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
							<div class="vertical_space_3"></div>
							<p><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(255); ?></a></p>
							<div class="vertical_space_5"></div>
							<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;">Data: <?php the_time(get_option('date_format')); ?> &nbsp;&nbsp;&nbsp;Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
							<div class="vertical_space_5"></div>					
						<?php
						} else { ?>
							<h2 style="text-align:left"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
							<div class="vertical_space_10"></div>
							<p><a class="cinza12" href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_excerpt_max_charlength(255); ?></a></p>	
							<div class="vertical_space_10"></div>
							<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;"><?php the_time(get_option('date_format')); ?> &nbsp;&nbsp;&nbsp;Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
							<div class="vertical_space_5"></div>
						<?php
						}
						?>
					</div>
					<?php
					}							
					if ( $aux > 1 ) { ?>
						<div class="destaque-home-duas-colunas-coluna-dois">
						<?php	
						if ( has_post_thumbnail() ) { ?>
							<div style="float:left;margin-right:5px;width:70px;">					
								<?php the_post_thumbnail('destaque-miolo-2'); ?>
							</div>
							<div style="margin:0;height:auto; width:232px;background-color:#fff;float:right;">
								<h2 style="text-align:left;font-size:14px"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>									
								<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;"><?php the_time(get_option('date_format')); ?></p>					
							</div>
							<div style="border:solid 1px #efefef;width:308px;margin:10px 0;"></div>							
						<?php
						} else { ?>
							<div style="margin:0;height:auto; width:308px;background-color:#fff;float:right;">
								<h2 style="text-align:left;font-size:14px"><a href="<?php echo get_post_meta( get_the_ID(), 'avpt_noticias_url', true ); ?>" target="_blank"><?php the_title(); ?></a></h2>
								<p style="color:#c2c2c2;font-size:11px;margin:5px 0 0 0;"><?php the_time(get_option('date_format')); ?></p>
							</div>
							<div class="clr"></div>
							<?php
							if ( $aux < 5 ) { ?>
								<div style="border:solid 1px #efefef;width:308px;margin:10px 0;"></div>
							<?php
							}
							?>
							
						<?php								
						}
						?>
						</div>
					<?php
					}													
				endwhile; 
			wp_reset_postdata();			
			endif;
		}			
	?>
	</div>
	<div class="clr"></div>
	<div style="border:solid 1px #efefef;width:630px;margin:10px 0 10px 25px;"></div>
<?php
}
// ========================================================================================================================================



// ========================================================================================================================================
// Bloco de notícias em destaque, mostra n notícia em linhas (Horizontal)
// 
// ========================================================================================================================================
function do_bloco_destaque_noticias_manual ($titulo, $icon, $categoria, $qtde, $corte, $slug=array()) { 
	do_title_bloc_news ($titulo, $icon); ?>
	<div class="destaque-home">		
		<?php
		
		$noticias = explode(",", $slug);
		$postCount = 0;
		$qtde = count($noticias);
		foreach ($noticias as $key => $value) {			
			$the_query = new WP_Query('category_name='.$categoria.'&posts_per_page='.$qtde.'&offset='.$corte.'&name='.$value); 
			if ( $the_query->have_posts() ) : 
				while ( $the_query->have_posts() ) : $the_query->the_post();
					$postCount = $postCount + 1;
					if ( has_post_thumbnail() ) { ?>
					<div style="margin: 10px 0 0 0;height:auto; width:5px;background-color:#efefef;float:left;"></div>
					<div style="margin: 10px 0 0 0;height:auto; width:140px;background-color:#fff;float:left;">
						<div style="float:left;margin-right:10px;width:140px;">					
							<?php the_post_thumbnail('mini'); ?>
						</div>
					</div>
					<div style="margin: 10px 0 0 0;height:auto; width:5px;background-color:#efefef;float:left;"></div>
					<div style="margin: 10px 0 0 0;height:auto; width:474px;background-color:#fff;float:left;">
						<h2><?php the_title(); ?></h2>
						<p style="color:#020202;font-size:10px;margin:5px 0 5px 0;"><?php the_time(get_option('date_format')); ?></p>
			    		<p><a style="color:#020202;" href="<?php echo get_post_meta($post->ID, 'url', true); ?>" target="_blank"><?php the_excerpt_max_charlength(150); ?></a></p>
			    		<p style="color:#020202;font-size:10px;margin:5px 0 0 0;">Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
					</div>				
					<div style="margin: 0; width:5px;background-color:#efefef;float:right;"></div>					
					<?php
					if ($qtde == 1) { ?>
						<div class="clr"></div>
						<div class="vertical_space_10"></div>
						<?php
						break;
					} 
					if ($qtde <= $qtde && $qtde > 1) { 
						if ($qtde == $postCount) { ?>
							<div class="clr"></div>
							<div class="vertical_space_10"></div>
							<?php
							break;
						} else { ?>
							<div class="clr"></div>
							<div style="border:dotted 1px #efefef;width:618px;margin:5px 5px 5px 5px;"></div>
						<?php
						}
					}					
				} else { ?>
					<div style="margin: 10px 0 0 0;height:auto; width:5px;background-color:#efefef;float:left;"></div>					
					<div style="margin: 10px 0 0 0;height:auto; width:613px;background-color:#fff;float:left;">
						<h2><?php the_title(); ?></h2>
						<p style="color:#020202;font-size:10px;margin:5px 0 5px 0;"><?php the_time(get_option('date_format')); ?></p>
			    		<p><a style="color:#020202;" href="<?php echo get_post_meta($post->ID, 'url', true); ?>" target="_blank"><?php the_excerpt_max_charlength(150); ?></a></p>
			    		<p style="color:#020202;font-size:10px;margin:5px 0 0 0;">Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
					</div>				
					<div style="margin: 0; width:5px;background-color:#efefef;float:right;"></div>
					<?php
					if ($qtde == 1) { ?>
						<div class="clr"></div>
						<div class="vertical_space_10"></div>
						<?php
						break;
					} 
					if ($qtde <=$qtde && $qtde > 1) { 
						if ($qtde == $postCount) { ?>
							<div class="clr"></div>
							<div class="vertical_space_10"></div>
							<?php
							break;
						} else { ?>
							<div class="clr"></div>
							<div style="border:dotted 1px #efefef;width:618px;margin:5px 5px 5px 5px;"></div>
						<?php
						}
					}						
				}
			endwhile; ?>
			<div class="clr"></div> 
			<?php
			wp_reset_postdata();			
		endif; 
		?>	
			
		<?php	
		}
		?>	
		</div>
		<div class="clr"></div>	
<?php			
}
// ========================================================================================================================================


// ========================================================================================================================================
// Bloco de notícias em destaque, mostra n notícia
// ========================================================================================================================================
function do_bloco_destaque_noticias_2 ($titulo, $icon, $categoria, $corte) { 
	do_title_bloc_news($titulo, $icon);?>
	<div class="destaque-home">
		<?php
		$postCount = 0;
		//$the_query = new WP_Query('category_name=noticias&posts_per_page=4'); 
		$the_query = new WP_Query('category_name='.$categoria.'&posts_per_page=4&offset='.$corte); 
		if ( $the_query->have_posts() ) : 
			while ( $the_query->have_posts() ) : $the_query->the_post();					
				if ( has_post_thumbnail() ) { ?> 
					<div style="margin:10px 0 0 0;height:auto;width:5px;background-color:#efefef;float:left;"></div>
					<div style="margin:10px 5px 0 0;height:auto;width:147px;border:0px solid #efefef;float:left;">
						<div style="float:left;margin-right:10px;width:147px;"><div class="clr"></div>					
							<div style="margin:2px;"><?php the_post_thumbnail( 'vai' ); ?></div>
						</div>
						<div style="margin:10px 2px 2px 2px;"><h2><?php the_title(); ?></h2></div>
						<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><?php the_time(get_option('date_format')); ?></p>
			    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><a style="color:#020202;" href="<?php echo get_post_meta($post->ID, 'url', true); ?>" target="_blank"><?php the_excerpt_max_charlength(100); ?></a></p>
			    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;">Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
					</div>
				<?php
				} else { ?>
					<div style="margin:10px 0 0 0;height:auto;width:5px;background-color:#efefef;float:left;"></div>
					<div style="margin:10px 5px 0 0;height:auto;width:147px;border:0px solid #efefef;float:left;">
						<div style="margin:10px 2px 2px 2px;"><h2><?php the_title(); ?></h2></div>
						<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><?php the_time(get_option('date_format')); ?></p>
			    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><a style="color:#020202;" href="<?php echo get_post_meta($post->ID, 'url', true); ?>" target="_blank"><?php the_excerpt_max_charlength(100); ?></a></p>
			    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;">Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
					</div>
				<?php
				}
			endwhile; 
			wp_reset_postdata();
		endif; 
		?>
		<div class="clr"></div>
		<div class="vertical_space_10"></div>		
	</div>
	<div class="clr"></div>
<?php
}
// ========================================================================================================================================


// ========================================================================================================================================
// Bloco de notícias em destaque, mostra n notícia
// ========================================================================================================================================
function do_bloco_destaque_noticias_3 ($titulo, $icon, $categoria, $qtde, $corte) { 
	do_title_bloc_news($titulo, $icon);?>
	<div class="destaque-home">
		<?php
		$postCount = 0;
		//$the_query = new WP_Query('category_name=noticias&posts_per_page=4'); 
		$the_query = new WP_Query('category_name='.$categoria.'&posts_per_page='.$qtde.'&offset='.$corte); 
		if ( $the_query->have_posts() ) : 
			while ( $the_query->have_posts() ) : $the_query->the_post();
				if ($qtde == 4) {
					if ( has_post_thumbnail() ) { ?> 
					<div style="margin:10px 0 0 0;height:auto;width:5px;background-color:#efefef;float:left;"></div>
					<div style="margin:10px 5px 0 0;height:auto;width:147px;border:0px solid #efefef;float:left;">
						<div style="float:left;margin-right:10px;width:147px;">
							<div class="clr"></div>					
							<div style="margin:2px;"><?php the_post_thumbnail( 'mini-3' ); ?></div>
						</div>
						<div style="margin:10px 2px 2px 2px;"><h2><?php the_title(); ?></h2></div>
						<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><?php the_time(get_option('date_format')); ?></p>
			    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><a style="color:#020202;" href="<?php echo get_post_meta($post->ID, 'url', true); ?>" target="_blank"><?php the_excerpt_max_charlength(100); ?></a></p>
			    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;">Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
					</div>
					<?php
					} else { ?>
						<div style="margin:10px 0 0 0;height:auto;width:5px;background-color:#efefef;float:left;"></div>
						<div style="margin:10px 5px 0 0;height:auto;width:147px;border:0px solid #efefef;float:left;">
							<div style="margin:10px 2px 2px 2px;"><h2><?php the_title(); ?></h2></div>
							<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><?php the_time(get_option('date_format')); ?></p>
				    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><a style="color:#020202;" href="<?php echo get_post_meta($post->ID, 'url', true); ?>" target="_blank"><?php the_excerpt_max_charlength(100); ?></a></p>
				    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;">Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
						</div>
					<?php
					}
				}	
				if ($qtde == 3) {
					if ( has_post_thumbnail() ) { ?> 
					<div style="margin:10px 0 0 0;height:auto;width:5px;background-color:#efefef;float:left;"></div>
					<div style="margin:10px 5px 0 0;height:auto;width:199px;border:0px solid #efefef;float:left;">
						<div style="float:left;margin-right:10px;width:147px;">
							<div class="clr"></div>					
							<div style="margin:2px;"><?php the_post_thumbnail( 'mini-4' ); ?></div>
						</div>
						<div style="margin:10px 2px 2px 2px;"><h2><?php the_title(); ?></h2></div>
						<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><?php the_time(get_option('date_format')); ?></p>
			    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><a style="color:#020202;" href="<?php echo get_post_meta($post->ID, 'url', true); ?>" target="_blank"><?php the_excerpt_max_charlength(100); ?></a></p>
			    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;">Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
					</div>
					<?php
					} else { ?>
						<div style="margin:10px 0 0 0;height:auto;width:5px;background-color:#efefef;float:left;"></div>
						<div style="margin:10px 5px 0 0;height:auto;width:199px;border:0px solid #efefef;float:left;">
							<div style="margin:10px 2px 2px 2px;"><h2><?php the_title(); ?></h2></div>
							<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><?php the_time(get_option('date_format')); ?></p>
				    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><a style="color:#020202;" href="<?php echo get_post_meta($post->ID, 'url', true); ?>" target="_blank"><?php the_excerpt_max_charlength(100); ?></a></p>
				    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;">Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
						</div>
					<?php
					}
				}
				if ($qtde == 2) {
					if ( has_post_thumbnail() ) { ?> 
					<div style="margin:10px 0 0 0;height:auto;width:5px;background-color:#efefef;float:left;"></div>
					<div style="margin:10px 5px 0 0;height:auto;width:303px;border:0px solid #efefef;float:left;">
						<div style="float:left;margin-right:10px;width:303px;">
							<div class="clr"></div>					
							<div style="margin:2px;"><?php the_post_thumbnail( 'mini-5' ); ?></div>
						</div>
						<div style="margin:10px 2px 2px 2px;"><h2><?php the_title(); ?></h2></div>
						<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><?php the_time(get_option('date_format')); ?></p>
			    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><a style="color:#020202;" href="<?php echo get_post_meta($post->ID, 'url', true); ?>" target="_blank"><?php the_excerpt_max_charlength(100); ?></a></p>
			    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;">Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
					</div>
					<?php
					} else { ?>
						<div style="margin:10px 0 0 0;height:auto;width:5px;background-color:#efefef;float:left;"></div>
						<div style="margin:10px 5px 0 0;height:auto;width:303px;border:0px solid #efefef;float:left;">
							<div style="margin:10px 2px 2px 2px;"><h2><?php the_title(); ?></h2></div>
							<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><?php the_time(get_option('date_format')); ?></p>
				    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><a style="color:#020202;" href="<?php echo get_post_meta($post->ID, 'url', true); ?>" target="_blank"><?php the_excerpt_max_charlength(100); ?></a></p>
				    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;">Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
						</div>
					<?php
					}
				}
				if ($qtde == 1) {
					if ( has_post_thumbnail() ) { ?> 
					<div style="margin:10px 0 0 0;height:auto;width:5px;background-color:#efefef;float:left;"></div>
					<div style="margin:10px 5px 0 0;height:auto;width:618px;border:0px solid #efefef;float:left;">
						<div style="float:left;margin-right:10px;width:618px;">
							<div class="clr"></div>					
							<div style="margin:2px;"><?php the_post_thumbnail( 'mini-6' ); ?></div>
						</div>
						<div style="margin:10px 2px 2px 2px;"><h2><?php the_title(); ?></h2></div>
						<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><?php the_time(get_option('date_format')); ?></p>
			    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><a style="color:#020202;" href="<?php echo get_post_meta($post->ID, 'url', true); ?>" target="_blank"><?php the_excerpt_max_charlength(300); ?></a></p>
			    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;">Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
					</div>
					<?php
					} else { ?>
						<div style="margin:10px 0 0 0;height:auto;width:5px;background-color:#efefef;float:left;"></div>
						<div style="margin:10px 5px 0 0;height:auto;width:618px;border:0px solid #efefef;float:left;">
							<div style="margin:10px 2px 2px 2px;"><h2><?php the_title(); ?></h2></div>
							<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><?php the_time(get_option('date_format')); ?></p>
				    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;"><a style="color:#020202;" href="<?php echo get_post_meta($post->ID, 'url', true); ?>" target="_blank"><?php the_excerpt_max_charlength(300); ?></a></p>
				    		<p style="color:#020202;font-size:10px;margin:10px 2px 5px 2px;">Fonte: <?php echo get_post_meta(get_the_ID(), 'avpt_noticias_fonte', true); ?></p>
						</div>
					<?php
					}
				}
			endwhile; 
			wp_reset_postdata();
		endif; 
		?>
		<div class="clr"></div>
		<div class="vertical_space_10"></div>		
	</div>
	<div class="clr"></div>
<?php
} 
// ========================================================================================================================================

?>








